package com.guigu.xm.yy.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.xm.pojo.*;
import com.guigu.xm.yy.mapper.*;
import com.guigu.xm.yy.service.YyDfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class YyDfileServiceimpl implements YyDfileService {
    @Autowired(required = false)
    YyDFileMapper dFileMapper;
    @Autowired(required = false)
    MDesignProcedureMapper mDesignProcedureMapper;
    @Autowired(required = false)
    MDesignProcedureDetailsMapper mDesignProcedureDetailsMapper;
    @Autowired(required = false)
    YyDModuleMapper yyDModuleMapper;
    @Autowired(required = false)
    YyDModuleDetailsMapper yyDModuleDetailsMapperl;
    @Autowired(required = false)
    MDesignProcedureModuleDetailsMapper mDesignProcedureModuleDetailsMapper;
    @Autowired(required = false)
    MApplyMapper mApplyMapper;
    @Autowired(required = false)
    MManufactureMapper mManufactureMapper;
    @Autowired(required = false)
    MProcedureMapper mProcedureMapper;
    @Autowired(required = false)
    MProceduringMapper mProceduringMapper;
    @Autowired(required = false)
    MProcedureModulingMapper mProcedureModulingMapper;
    @Autowired(required = false)
    MProcedureModuleMapper mProcedureModuleMapper;
    @Override
    public PageVo fenyeaList(Integer page, Integer pageNum, DFile dFile) {
        PageHelper.startPage(page,pageNum);
        List<DFile> fenyeall = dFileMapper.fenyeall(dFile);
        PageInfo<DFile> info=new PageInfo<>(fenyeall);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public DFile chacpid(String productId) {
        return dFileMapper.chacpid(productId);
    }

    @Override
    public int update(String productId) {
        return dFileMapper.update(productId);
    }

    @Override
    public int add(MDesignProcedure mDesignProcedure) {
        return mDesignProcedureMapper.add(mDesignProcedure);
    }

    @Override
    public int add1(MDesignProcedureDetails mDesignProcedureDetails) {
        return mDesignProcedureDetailsMapper.add1(mDesignProcedureDetails);
    }

    @Override
    public PageVo fenyeaList1(Integer page, Integer pageNum, MDesignProcedure mDesignProcedure) {
        PageHelper.startPage(page,pageNum);
        List<MDesignProcedure> all = mDesignProcedureMapper.all(mDesignProcedure);
        PageInfo<MDesignProcedure> info=new PageInfo<>(all);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public String selId() {
        return mDesignProcedureMapper.selId();
    }

    @Override
    public List<MDesignProcedure> dbcha(String productId) {
        return mDesignProcedureMapper.dbcha(productId);
    }

    @Override
    public int update(MDesignProcedure mDesignProcedure) {
        return mDesignProcedureMapper.update(mDesignProcedure);
    }

    @Override
    public PageVo cha(Integer page, Integer pageNum, MDesignProcedure mDesignProcedure) {
       PageHelper.startPage(page,pageNum);
        List<MDesignProcedure> cha = mDesignProcedureMapper.cha(mDesignProcedure);
        PageInfo<MDesignProcedure> info = new PageInfo<>(cha);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public List<MDesignProcedure> xlk() {
        return mDesignProcedureMapper.xlk();
    }

    @Override
    public PageVo list(Integer page, Integer pageNum) {
        PageHelper.startPage(page,pageNum);
        List<MDesignProcedure> list = mDesignProcedureMapper.list();
        PageInfo<MDesignProcedure> info = new PageInfo<>(list);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public List<MDesignProcedure> slal(String designId) {
        List<MDesignProcedure> slal = mDesignProcedureMapper.slal(designId);
        return slal;
    }

    @Override
    public List<DModule> all(String product_id) {
        return yyDModuleMapper.all(product_id);
    }

    @Override
    public int xg(DModuleDetails dModuleDetails) {
        return yyDModuleDetailsMapperl.xg(dModuleDetails);
    }

    @Override
    public String selid() {
        return mManufactureMapper.selid();
    }

    @Override
    public List<MDesignProcedure> allGxu(String parent_id) {
        return mDesignProcedureMapper.allGxu(parent_id);
    }

    @Override
    public List<MDesignProcedureModuleDetails> allWuliao(String parent_id) {
        return mDesignProcedureModuleDetailsMapper.allWuliao(parent_id);
    }

    @Override
    public int insertMP(MProcedure record) {
        return mProcedureMapper.insert(record);
    }

    @Override
    public int insertmpm(MProcedureModule record) {
        return mProcedureModuleMapper.insert(record);
    }

    @Override
    public int insertMf(MManufacture record) {
        return  mManufactureMapper.insert(record);
    }

    @Override
    public PageVo<MManufacture> allShdan(String page,String num,String cha) {
        page=page==null?"1":page;
        num=num==null?"3":num;
        cha=cha==null?"":cha;
        PageHelper.startPage(Integer.parseInt(page),Integer.parseInt(num));
        List<MManufacture> mManufactures = mManufactureMapper.allShdan(cha);
        PageInfo pageInfo=new PageInfo(mManufactures);
        PageVo pageVo=new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(mManufactures);
        return pageVo ;
    }

    @Override
    public MManufacture chaShdan(String manufactureId) {
        return mManufactureMapper.chaShdan(manufactureId);
    }

    @Override
    public int ShenHe(String manufactureId) {
        return mManufactureMapper.ShenHe(manufactureId);
    }

    @Override
    public int update(int mid) {
        return mDesignProcedureDetailsMapper.update(mid);
    }

    @Override
    public int xgxj(MDesignProcedureDetails mDesignProcedureDetails) {
        return mDesignProcedureDetailsMapper.xgxj(mDesignProcedureDetails);
    }

    @Override
    public int add2(MDesignProcedureModuleDetails mDesignProcedureModuleDetails) {
        return mDesignProcedureModuleDetailsMapper.add2(mDesignProcedureModuleDetails);
    }

    @Override
    public int upzt(String procedureId) {
        return mDesignProcedureMapper.upzt(procedureId);
    }

    @Override
    public PageVo list11(Integer page, Integer pageNum) {
        PageHelper.startPage(page,pageNum);
        List<MDesignProcedure> mDesignProcedures = mDesignProcedureMapper.list1();
        PageInfo<MDesignProcedure> info = new PageInfo<>(mDesignProcedures);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public int upshwl(MDesignProcedure mDesignProcedure) {
        return mDesignProcedureMapper.upshwl(mDesignProcedure);
    }

    @Override
    public PageVo cha1(Integer page, Integer pageNum, MDesignProcedure mDesignProcedure) {
        PageHelper.startPage(page,pageNum);
        List<MDesignProcedure> mDesignProcedures = mDesignProcedureMapper.cha1(mDesignProcedure);
        PageInfo<MDesignProcedure> info = new PageInfo<>(mDesignProcedures);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public PageVo shenc(Integer page, Integer pageNum) {
        PageHelper.startPage(page,pageNum);
        List<DFile> shenchan = dFileMapper.shenchan();
        PageInfo<DFile> info = new PageInfo<>(shenchan);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public int add(MApply mApply) {
        return mApplyMapper.add(mApply);
    }

    @Override
    public String selId1() {
        return mApplyMapper.selId1();
    }

    @Override
    public PageVo chajh1(Integer page, Integer pageNum) {
        PageHelper.startPage(page,pageNum);
        List<MApply> shjh = mApplyMapper.shjh();
        PageInfo<MApply> info = new PageInfo<>(shjh);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public List<MApply> shjh1(String applyId) {
        return mApplyMapper.shjh1(applyId);
    }

    @Override
    public int update(MApply mApply) {
        return mApplyMapper.update(mApply);
    }

    @Override
    public PageVo chasy(Integer page, Integer pageNum,MApply mApply) {
        PageHelper.startPage(page,pageNum);
        List<MApply> chasy = mApplyMapper.chasy(mApply);
        PageInfo<MApply> info = new PageInfo<>(chasy);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public PageVo chanb(Integer page, Integer pageNum) {
        PageHelper.startPage(page,pageNum);
        List<MManufacture> chanb = mManufactureMapper.chanb();
        PageInfo<MManufacture> info = new PageInfo<>(chanb);
        PageVo pageVo = new PageVo();
        pageVo.setRows(info.getList());
        pageVo.setTotal(info.getTotal());
        return pageVo;
    }

    @Override
    public PageVo chanbsy(Integer page, Integer pageNum, MManufacture mManufacture) {
        PageHelper.startPage(page,pageNum);
        List<MManufacture> chanbsy = mManufactureMapper.chanbsy(mManufacture);
        PageInfo<MManufacture> info = new PageInfo<>(chanbsy);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(info.getTotal());
        pageVo.setRows(info.getList());
        return pageVo;
    }

    @Override
    public MManufacture chadj(String manufactureId) {
        MManufacture chadj = mManufactureMapper.chadj(manufactureId);
        return chadj;
    }

    @Override
    public List<MProcedure> chagx(String parentId) {
        List<MProcedure> chagx = mProcedureMapper.chagx(parentId);
        return chagx;
    }

    @Override
    public List<MProcedure> djc(String detailsInt,String parentId) {
        List<MProcedure> djc = mProcedureMapper.djc(detailsInt,parentId);
        return djc;
    }

    @Override
    public int xgsczb(MProcedure mProcedure) {
        int xgsczb = mProcedureMapper.xgsczb(mProcedure);
        return xgsczb;
    }

    @Override
    public int add(MProceduring mProceduring) {
        int insert = mProceduringMapper.add(mProceduring);
        return insert;
    }

    @Override
    public int add(MProcedureModuling mProcedureModuling) {
        int add = mProcedureModulingMapper.add(mProcedureModuling);
        return add;
    }

    @Override
    public PageVo chafh(Integer page, Integer pageNum) {
        PageHelper.startPage(page,pageNum);
        List<MManufacture> chafh = mManufactureMapper.chafh();
        List<MManufacture> Manufacture = mManufactureMapper.chafh1();
        ArrayList<MManufacture> ll = new ArrayList<>();
        ll.addAll(chafh);
        ll.addAll(Manufacture);
        PageInfo<MManufacture> info = new PageInfo<>(ll);
        PageVo pageVo = new PageVo();
        pageVo.setRows(info.getList());
        pageVo.setTotal(info.getTotal());
        return pageVo;
    }

    @Override
    public MManufacture fhdj(String manufactureId) {
        MManufacture fhdj = mManufactureMapper.fhdj(manufactureId);
        return fhdj;
    }

    @Override
    public List<MProcedure> chafhgx(String parentId) {
        List<MProcedure> chafhgx = mProcedureMapper.chafhgx(parentId);
        return chafhgx;
    }

    @Override
    public List<MProceduring> fuhecha(String detailsInt, String parentId) {
        List<MProceduring> fuhucha = mProceduringMapper.fuhucha(detailsInt, parentId);
        return fuhucha;
    }

    @Override
    public int fhtg(MProcedure mProcedure) {
        int fhtg = mProcedureMapper.fhtg(mProcedure);
        return fhtg;
    }

    @Override
    public int gxsl(Integer detailsInt,String parentId,Integer realAmount) {
        int gxsl = mProcedureMapper.gxsl(detailsInt,parentId,realAmount);
        return gxsl;
    }

    @Override
    public int gxslfh(Integer detailsInt, String parentId) {
        int gxslfh = mProcedureMapper.gxslfh(detailsInt, parentId);
        return gxslfh;
    }

    @Override
    public int xgzt(String manufactureId) {
        int xgzt = mManufactureMapper.xgzt(manufactureId);
        return xgzt;
    }
}
